import { createI18n } from 'vue-i18n'
import zh from './package/zh'
import en from './package/en'

import { useSettingStoreHook } from '@/store/module/settings'

export function setupI18N(app) {
  console.log('注册i18n')
  // 在组件外使用仓库
  const settingStore = useSettingStoreHook()

  const i18n = createI18n({
    legacy: false,
    locale: settingStore.lang,
    fallbackLocale: 'en',
    messages: {
      en,
      zh,
    },
  })
  app.use(i18n)
}

// export default i18n
